package com.gufe.mapper.user.prereserve;

import com.gufe.entity.BasicInfo;
import com.gufe.entity.MilitaryInfo;
import com.gufe.entity.RetiredInfo;
import com.gufe.entity.StudyExperienceInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface SaveInfoMapper {
    /**
     * 存储数据
     * @param basicInfo
     */
    @Insert("insert into basic_info (user_id, name, gender, id_card, political_affiliation, profile_picture, birth_date, nationality, marital_status, religious_affiliation, " +
            "native_place, home_address, mailing_address, college, major, student_id, science_or_humanities, grade, class_name, telephone, qq, high_school_physical_grade, university_physical_grade, professional_certificates, " +
            "class_position, club_name, club_join_date, club_leave_date, high_school_name, high_school_address, high_school_subject_type) " +
            "values (#{userId}, #{name}, #{gender}, #{idCard}, #{politicalAffiliation}, #{profilePicture}, #{birthDate}, #{nationality}, #{maritalStatus}, #{religiousAffiliation}," +
            "#{nativePlace}, #{homeAddress}, #{mailingAddress}, #{college}, #{major}, #{studentId}, #{scienceOrHumanities}, #{grade}, #{className}, #{telephone}, #{qq}, #{highSchoolPhysicalGrade}, #{universityPhysicalGrade}, #{professionalCertificates}, " +
            "#{classPosition}, #{clubName}, #{clubJoinDate}, #{clubLeaveDate}, #{highSchoolName}, #{highSchoolAddress}, #{highSchoolSubjectType})")
    void saveBasicInfo(BasicInfo basicInfo);

    /**
     * 存储军事社团信息
     * @param militaryInfo
     */
    @Insert("insert into military_info (user_id, is_military_club_member, military_club_join_date, military_club_name, military_club_position, height, weight, vision, has_medical_history, physical_condition, psychological_interview, has_military_training, " +
            "military_training_duration, military_club_leave_date, military_club_leave_develop) " +
            "values (#{userId}, #{isMilitaryClubMember}, #{militaryClubJoinDate}, #{militaryClubName}," +
            "#{militaryClubPosition}, #{height}, #{weight}, #{vision}, #{hasMedicalHistory}, " +
            "#{physicalCondition}, #{psychologicalInterview}, #{hasMilitaryTraining}," +
            "#{militaryTrainingDuration}, #{militaryClubLeaveDate}, #{militaryClubLeaveDevelop})")
    void saveMilitaryInfo(MilitaryInfo militaryInfo);

    /**
     * 存储退役信息
     * @param retiredInfo
     */
    @Insert("insert into retired_info (user_id, is_served_in_military, military_branch, unit_number, rankname, first_enlistment_date, enlistment_date, enlistment_place, discharge_date, military_specialty, military_position, " +
            "awards, is_reserved_military, reserved_position, reserved_specialty)" +
            "values (#{userId}, #{isServedInMilitary},#{militaryBranch},#{unitNumber},#{rankname}, #{firstEnlistmentDate},#{enlistmentDate},  " +
            "#{enlistmentPlace},  #{dischargeDate}, + #{militarySpecialty}, + #{militaryPosition},  #{awards}, #{isReservedMilitary},#{reservedPosition}, #{reservedSpecialty})")
    void saveRetiredInfo(RetiredInfo retiredInfo);

    /**
     * 存储学习经历信息
     * @param studyExperienceInfo
     */
    @Insert("insert into study_experience_info (user_id, primary_school_name, middle_school_name, high_school_name, university_name, primary_school_start_date, middle_school_start_date, " +
            "high_school_start_date, university_start_date, primary_school_end_date, middle_school_end_date, high_school_end_date, university_end_date) " +
            "VALUES (#{userId}, #{primarySchoolName}, #{middleSchoolName}, #{highSchoolName}, #{universityName}, + #{primarySchoolStartDate}, #{middleSchoolStartDate}, " +
            "#{highSchoolStartDate}, #{universityStartDate}, #{primarySchoolEndDate}, #{middleSchoolEndDate}, #{highSchoolEndDate}, #{universityEndDate})")
    void saveStudyInfo(StudyExperienceInfo studyExperienceInfo);
}
